package 力扣._392判断子序列;

public class Solution2 {
    public boolean isSubsequence(String s, String t) {
        //双指针,这个不要求连续，若存在，则一次遍历必然找到
        int i = 0, j = 0;
        while (i < t.length() && j < s.length())
            if (t.charAt(i) == s.charAt(j)) {
                i++;
                j++;
            } else {
                i++;
            }
        return j == s.length();
    }
}
